package com.heima.wemedia.scan.runner;

import com.heima.utils.common.SensitiveWordUtil;
import com.heima.wemedia.scan.dao.WmSensitiveDao;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
public class WmNewsApplicationRunner implements ApplicationRunner {

    @Resource
    private WmSensitiveDao wmSensitiveDao;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //2.查询敏感词列表
        List<String> wordList = wmSensitiveDao.queryWordList();
        //初始化关键词字典库
        SensitiveWordUtil.initMap(wordList);
    }
}
